<?php
include_once "header.php";

$daftar_user = new Daftar_user();
$user = $daftar_user->getAll();





?>

<div id="container">
	<div id="maincont">
		<?php include_once "menu_samping.php"; ?>
		<div id="mainright">
			<div id="title">
			Daftar Pengguna
			</div>
			<div id="body">
			<br>	
			
			
			<table id="table2" cellspacing=0 cellpadding=4 width=100%>
				<tr>
					<th>No.</th>
					<th>NIP</th>
					<th>Nama</th>
					<th>Email</th>
					<th>Status Pengguna</th>
					<th></th>
					
				</tr>
				<?php
				$j=1;
				foreach($user as $User){?>
				
				<tr>
					<td><?php echo $j; ?></td>
					<td>
					<?php 
						echo $User->getNip();
					?>
					</td>
					
					<td>
					<?php
						echo $User->getNama();
					
					?>
					</td>
					
					<td><?php
					echo $User->getEmail();
					?></td>
					
					<td>
					<?php 
					if($User->getAktif()==0){$status="Tidak aktif";}
					if($User->getAktif()==1){$status="Aktif";}
					echo ucwords($status);
					?>
					</td>
					
					<td><?php 
					
						echo "<a href=\"ubah_pengguna.php?nip=".$User->getNip()."\" >";
						echo "<img src=\"images/Text-Edit-icon.png\" alt=\"ubah\" title=\"ubah\" width=15px height=15px/></a></a> ";;
						echo "   ";
						
						echo "<a href=\"hapus_pengguna.php?nip=".$User->getNip()."\" onclick=\"return del()\">";
						echo "<img src=\"images/delete-icon.png\" alt=\"hapus\" title=\"hapus\" width=15px height=15px/></a> ";
						
						
					
					?></td>
					
					
				
				</tr>
				
				<?php $j++;} ?>
			</table>
			<?php
			if(empty($user)){
				echo "<table cellspacing=0 cellpadding=4 width=100%>";
				echo "<tr>";
				echo "<td>";
					echo "Data tidak tersedia.";	
				echo "</td>";			
				echo "</tr>";
				echo "</table>";
			}
			?>
			<br>
			<input type="button" value="Rekam" onClick="window.location.href='rekam_pengguna.php'">		
			</div>
        </div>
	</div>
</div>
<?php
	include_once "footer.php";
?>

<script type="text/javascript">
	function del(){
	if(confirm('Apakah Anda yakin akan menghapus data ini?'))
	return true;
	else return false
	}
	
	
	
</script>

